<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery-3.3.1.min.js"></script>
</head>
<body>
<img src="img/bulboff.gif" alt="关灯">
<img src="img/bulbon.gif" alt="开灯">
<img src="img/star.gif" alt="星星">
</body>
<script>
    $(function () {
        $("img").click(function (event) {
            // alert($(this).attr("alt"));
            if ($(this).attr("alt") == "开灯"){
                $(this).attr("src","img/bulboff.gif")
                $(this).attr("alt","关灯")
            }
        })
    })
</script>
</html>